package com.example.chainOfResponsibility;

import com.example.chainOfResponsibility.extend.HandlerOne;
import com.example.chainOfResponsibility.extend.HandlerThree;
import com.example.chainOfResponsibility.extend.HandlerTwo;

/**
 * 责任链模式，可以用于大量优化if语句
 */
public class Test {
    public static void main(String[] args) {
        HandlerOne handlerOne = new HandlerOne();
        HandlerTwo handlerTwo = new HandlerTwo();
        HandlerThree handlerThree = new HandlerThree();

        handlerOne.setHandler(handlerTwo);
        handlerTwo.setHandler(handlerThree);

        handlerOne.handleRequest(18);
    }
}
